﻿<UserControl x:Class="EmailClientWPF.Views.LoginRegisterFormView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:viewModels="clr-namespace:EmailClientWPF.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="210">
    <StackPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" 
                       HorizontalAlignment="Right"
                       Grid.Column="0">Username </TextBlock>
            <TextBox Grid.Row="0"
                     HorizontalAlignment="Left"
                     Grid.Column="1" Width="145"
                     Text="{Binding Username}"/>
        
            <TextBlock Grid.Row="1" 
                       HorizontalAlignment="Right"
                       Grid.Column="0">Password </TextBlock>
            <PasswordBox Name="BoxPassword"
                         Password="123456q"
                         Grid.Row="1"
                         Grid.Column="1"
                         Width="145"
                         HorizontalAlignment="Left" />
            <StackPanel Orientation="Horizontal" 
                        Grid.Row="2" 
                        Grid.Column="0" 
                        Grid.ColumnSpan="2">
                <Button Content="Login"
                        Command="{Binding Login}"
                        CommandParameter="{Binding ElementName=BoxPassword}"
                        Width="100" Grid.ColumnSpan="2" Margin="0 0 5 0"
                        />

                <Button Content="Register"
                        Command="{Binding Register}"
                        CommandParameter="{Binding ElementName=BoxPassword}"
                        Width="100" Margin="5 0 0 0"
                        />
            </StackPanel>
    
        </Grid>
            <TextBlock Foreground="Red"
                       TextAlignment="Center"
                       Text="{Binding Path=ErrorMessage,Mode=OneWay}"                 
                       />
    </StackPanel>
</UserControl>
